<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <comp @see="print"></comp>
    </div>

    <template id="comp_template">
        <div>
            <button @click="start">子组件按钮</button>
        </div>
    </template>
    <script>
        new Vue({
            el: "#app",
            methods: {
                print() {
                    window.alert("执行了父组件的print方法")
                }
            },
            components: {
                comp: {
                    template: "#comp_template",
                    methods: {
                        start() {
                            // 触发父组件绑定在子组件上的事件
                            this.$emit("see")
                        }
                    }
                }                
            }
        })
    </script>
</body>
</html>